import komand
from .schema import GetMalwareInput, GetMalwareOutput, Input, Output, Component
from ...util import project


class GetMalware(komand.Action):

    def __init__(self):
        super(self.__class__, self).__init__(
                name='get_malware',
                description=Component.DESCRIPTION,
                input=GetMalwareInput(),
                output=GetMalwareOutput())

    def run(self, params={}):
        return {
            Output.MALWARE: project.Project(self.connection.config, params.get(Input.PROJECT_NAME)).get_malware(params.get(Input.SHA256)).dump()
        }
